<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>解构</title>
</head>
<body>
    <script>

        //数组的解构
        var names = ["cq","cqq","cqq","cqqq","kjsjsn"];
        [name1,name2,name3,...args] = names;
        console.log(name1,name2,name3,args);
        
        //对象的解构
        const obj = {
            name:"cq",
            age:"18",
            id:Symbol("id"),
            grates:100,
            nickName:"xixo"
        }
        var {name,age,id,...args} = obj;//使用let还有作用域问题导致访问不了args
        console.log(name,age,id,args);
    </script>
</body>
</html>